home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue28 / drmeter / DRMETER.ZIP / DRMETER.DOC next >
Encoding:
Text File  |  1997-10-23  |  4.2 KB  |  112 lines

  1. {========================================================|
  2. | DrMeter (Ver 1.00) - (c) 1997 by Alvaro L. S. Almeida  |
  3. |--------------------------------------------------------|
  4. | Pointer meter. Like a VU used in sound equipments. It  |
  5. | is good to indicate, for example, percentage, Volts... |
  6. | For Delphi 1, 2 e 3 (16 and 32 bits)                   |
  7. |                                                        |
  8. | See other components in our home-page.                 |
  9. |--------------------------------------------------------|
  10. | DROID Informatica ltda - Rio de Janeiro - Brazil       |
  11. |                                                        |
  12. | Home Page: http://www.di.com.br                        |
  13. | E-Mail:    comp@di.com.br                              |
  14. | Fax:       055 021 224-0331                            |
  15. |========================================================}
  16.  
  17. unit drMeter;
  18.  
  19. interface
  20.  
  21. uses
  22.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  23.   Forms, Dialogs;
  24.  
  25. type
  26.   TVuBorder = (boNone, boSingle, boRaised, boLowered);
  27.   TVuDispScale = (dsDefault, dsPercent, dsDivBy10, dsDivBy100, dsDivBy1000, dsDivBy10000);
  28.  
  29.   TDRMeter = class(TGraphicControl)
  30.   private
  31.     FDivisor,                { Used by TVuDispScale }
  32.     radius,
  33.     FScalePoints : integer;  { number of points in the scale of the meter }
  34.  
  35.     FBackColor   : TColor;
  36.     FScaleColor  : TColor;
  37.     FPointerColor: TColor;
  38.  
  39.     FDispGrad    : boolean;  { if true, display gradient }
  40.     FDispText    : boolean;  { if true, display values   }
  41.  
  42.     scale,                   { max - min }
  43.     FMax,                    { max }
  44.     FMin,                    { min }
  45.     FPosition,               { Actual "position" }
  46.     OldPointer   : LongInt;  { Old "position"    }
  47.  
  48.     xc,yc,                   { xc: width div 2 - yc: heigth div 2 }
  49.     lx,ly,base   : integer;  { base: radius of the base of the pointer }
  50.  
  51.     FBorder      : TVuBorder;{ Border type }
  52.  
  53.     LabelLoc,
  54.     BasePointer,             { width of the bottom of the pointer }
  55.     PointerMult,             { used to calculate the size of the pointer }
  56.     LineMult1,               { used to calculate the size of the scale points }
  57.     LineMult2,               { used to calculate the size of the scale points }
  58.     TextMult     : real;     { used to calculate the text position }
  59.  
  60.     FDispScale   : tVuDispScale;
  61.  
  62.   protected
  63.     procedure Paint; override;
  64.     procedure SetPointer(posi:LongInt; clear:boolean);
  65.     procedure SetMults;
  66.  
  67.   public
  68.     constructor Create(AOwner: TComponent); override;
  69.  
  70.   published
  71.     property Align;
  72.     property Enabled;
  73.     property Visible;
  74.     property Font;
  75.     property ShowHint;
  76.     property DisplayScale:    TVuDispScale read  FDispScale
  77.                                            write SetDispScale;
  78.     property DisplayGradient: boolean      read  FDispGrad
  79.                                            write SetDispGrad;
  80.     property DisplayText:     boolean      read  FDispText
  81.                                            write SetDispText;
  82.     property Position:        LongInt      read  FPosition
  83.                                            write SetPosition;
  84.     property Color:           TColor       read  FBackColor
  85.                                            write SetBackColor;
  86.     property ScaleColor:      TColor       read  FScaleColor
  87.                                            write SetScaleColor;
  88.     property PointerColor:    TColor       read  FPointerColor
  89.                                            write SetPointerColor;
  90.     property ScalePoints:     integer      read  FScalePoints
  91.                                            write SetScalePoints;
  92.     property Max:             LongInt      read  FMax
  93.                                            write SetMax;
  94.     property Min:             LongInt      read  FMin
  95.                                            write SetMin;
  96.     property Border:          TVuBorder    read  FBorder
  97.                                            write SetBorder;
  98.   end;
  99.  
  100. procedure Register;
  101.  
  102. implementation
  103.  
  104. { . . . }
  105.  
  106. procedure Register;
  107. begin
  108.   RegisterComponents('DROID', [tDrMeter]);
  109. end;
  110.  
  111. end.
  112.